import {
  Swipe,
  SwipeItem,
  Lazyload,
  Badge,
  Sidebar,
  SidebarItem,
  Collapse,
  CollapseItem,
  Tab,
  Tabs,
  Card,
  Image as VanImage,
  Button,
  Tag,
  Form,
  Field
} from 'vant'

const components = [
  Lazyload,
  Swipe,
  SwipeItem,
  Badge,
  Sidebar,
  SidebarItem,
  Collapse,
  CollapseItem,
  Tab,
  Tabs,
  Card,
  VanImage,
  Button,
  Tag,
  Form,
  Field
]

export default function(app) {
  components.forEach(c => {
    if (c === Lazyload) {
      app.use(c, {
        lazyComponent: true,
        loading: require('assets/images/icon/loading.gif'),
        error: require('assets/images/icon/loading.gif')
      })
    } else {
      app.use(c)
    }
  })
}
